<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->
<template>
  <div class="wrap">
    <Tabs2 :data="['基础属性', '抄送人设置']" @on-tab="handleTab" :height="40" :tab="tab" />

    <BaseInfo v-if="tab === 0" :item="item" @on-item="handleBaseInfo" />

    <div class="tab" v-if="tab === 1">
      <div class="padding">
        <el-radio v-model="personType" :label="assignType.t1">指定成员</el-radio>
        <el-radio v-model="personType" :label="assignType.t2">表单里的联系人</el-radio>
        <el-radio v-model="personType" :label="assignType.t4">角色</el-radio>
      </div>
      <div class="padding">

        <user-choose :column="columnUser"  v-if="personType === assignType.t1"   @userSelected="getChooseUsers" v-model="userDataIds" :value="userDataIds"></user-choose>

        <el-select v-if="personType === assignType.t2" v-model="contactValue" placeholder="请选择表单里的人">
          <el-option v-for="item in fieldContacts" :key="item.prop" :label="item.label" :value="item.prop"> </el-option>
        </el-select>


        <div v-if="personType === assignType.t4">
          <role-tree-choose  v-if="assignType.t4"  v-model="roleInfo.id" :column="columnRole" @selectItemsObj="getChooseRole"></role-tree-choose>
          <div style="padding-top: 10px">
            <el-switch v-if="assignType.t4" v-model="roleInfo.relateStartOrgId" active-color="#409eff"> </el-switch>
            <span class="label">是否关联发起人所在部门</span>
          </div>
        </div>


      </div>


    </div>


  </div>
</template>

<script>
import {  mixinTabs, mixinAssignMember } from '../mixins'
export default {
  mixins: [mixinTabs, mixinAssignMember],
  data() {
    return {
      columnUser: {userType:"org",value:"",prop:"acceptUser",multiple:true},
      columnRole: {multiple:false},
    }
  },
  methods: {
    // handleBaseInfo(item) {
    //   this.$emit('on-item', item)
    // },
    getChooseUsers(data){
      this.userDatas = [];
      data.forEach(ele => {
        this.userDatas.push({id:ele.id,name:ele.nickName})
      })
    },
    getChooseRole(data){
      this.roleInfo = data&&data.length>0?data[0]:{};
    }
  }
}
</script>

<style lang="scss" scoped>
@import './pop.scss';
</style>
